package org.vsaulyak.springrssagregator.entity;

import java.util.List;
import javax.validation.constraints.Size;
import javax.validation.constraints.Pattern;

public class Chanel
{
    private String id;
    private String link;
    private String title;
    private List<Item> items;
    
    @Size(min=3, max=255, message="Chanel ID must be between 3 and 255 characters long")
    @Pattern(regexp="^[a-zA-Z0-9-]+$", message="Chanel ID must contain leters, dgits and dashes only")
    public String getId()
    {
        return id;
    }
    
    public void setId(String id)
    {
        this.id = id;
    }
    
    @Size(min=2, max=255, message="Chanel link must be between 2 and 255 characters long")
    public String getLink()
    {
        return link;
    }
    
    public void setLink(String link)
    {
        this.link = link;
    }
    
    @Size(min=2, max=255, message="Chanel title must be between 2 and 255 characters long")
    public String getTitle()
    {
        return title;
    }
    
    public void setTitle(String title)
    {
        this.title = title;
    }
    
    public List<Item> getItems()
    {
        return items;
    }
    
    public void setItems(List<Item> items)
    {
        this.items = items;
    }
    
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append(id).append("\n");
        sb.append(link).append("\n");
        sb.append(title).append("\n");
        if (null != items)
        {
            sb.append(items.toString()).append("\n");
        }
        
        return sb.toString();
    }
}
